package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conexion {

	static Connection cn;
	
	static{
		try {
			Class.forName("com.ibm.as400.access.AS400JDBCDriver");
			cn = DriverManager.getConnection("jdbc:as400://192.168.1.7/SPEED400TC", "dparreno", "m140202");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		} 
	}

	public static Connection obtenerConexion() {
		return cn;
	}

	public static void desconectar() throws SQLException {
		cn.close();	
	}
	
	public static void reconectar() throws SQLException {
		cn = DriverManager.getConnection("jdbc:as400://192.168.1.7/SPEED400TC", "dparreno", "m140202");
	}
		
}